package log

import (
	"fmt"
	"gitee.com/aurora-engine/utils/logutils"
	"github.com/sirupsen/logrus"
	"os"
)

/*
	app 全局日志
*/

var logs *logrus.Logger

func init() {
	logs = logrus.New()
	//logutils.NewOut("logfile", "administratorLog")
	multi := logutils.NewMultiFormatter("ADMINISTRATOR", os.Stdout)
	logs.SetFormatter(multi)
	logs.Out = multi
	logs.SetLevel(logrus.DebugLevel)
	logs.SetReportCaller(true)
}

func Log() *logrus.Logger {
	return logs
}

func Info(msg ...any) {
	logs.Info(msg...)
}
func Debug(msg ...any) {
	logs.WithField(logutils.Pkg, 1).Debug(msg...)
}
func Error(err ...any) {
	logs.WithField(logutils.Pkg, 1).Error(err...)
}

type MyHook struct {
}

func (hook MyHook) Levels() []logrus.Level {

	return []logrus.Level{logrus.InfoLevel}
}

func (hook MyHook) Fire(entry *logrus.Entry) error {
	fmt.Println()
	return nil
}
